﻿/*******************************************************************\
| Author:    Andrew Gamez agamez2009@my.fit.edu                     |
| Date:      March 25, 2011                                         |
| Class:     SAWGUI                                                 |
| Descr:     The form that acts as a GUI for the user.              |
\*******************************************************************/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace SaveAWatt.GUI
{
    public partial class SettingsForm : Office2007Form
    {
        public static bool useCostForGraphing = true;
        public static decimal costPer_kWh = 0.15M;
        public static decimal graphSharpnessFactor = 60M;
        public static bool showBlueAverageBar = true;
        public static string yAxisString = "Electricity Usage in USD";
        public static int zoomSettingKey = 0; // 0 = all data, 1 = today, 2 = this week, 3 = this month, 4 = this year.

        public SettingsForm()
        {
            InitializeComponent();
        }

        private void settings_Load(object sender, EventArgs e)
        {
            if (useCostForGraphing)
            {
                radioButton2.Select();
            }
            else
            {
                radioButton1.Select();
            }
            numericUpDown1.Value = costPer_kWh;
            numericUpDown2.Value = graphSharpnessFactor;
            checkBox1.Checked = showBlueAverageBar;
            comboBox1.SelectedIndex = zoomSettingKey;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void settings_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (radioButton1.Checked)
            {
                useCostForGraphing = false;
                yAxisString = "Electricity Usage in Kilowatt Hours";
            }
            else
            {
                useCostForGraphing = true;
                yAxisString = "Electricity Usage in USD";
            }
            costPer_kWh = numericUpDown1.Value;
            graphSharpnessFactor = numericUpDown2.Value;
            showBlueAverageBar = checkBox1.Checked;
            zoomSettingKey = comboBox1.SelectedIndex;
        }
    }
}
